package com.sinoyd.itszyw.Model;

import org.json.JSONObject;
import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

import java.io.Serializable;

/**
 * @createBy : Sinoyd 大饼洲
 * @description :
 * @projectName : ITYW
 * @creationDate: 2017-03-14 17:05
 */

@Table(name = "task_info", onCreated = "")

public class MaintainTaskInfo implements Serializable {

    /**
     * name = "id"：数据库表中的一个字段
     * isId = true：是否是主键
     * autoGen = true：是否自动增长
     * property = "NOT NULL"：添加约束
     */
    @Column(name = "id", isId = true, autoGen = true, property = "NOT NULL")
    private int id;
    /**
     * 任务id
     */
    @Column(name = "task_Id")
    public String taskId;

    /**
     * 用户Id
     */
    @Column(name = "user_Id")
    public String userId;

    /**
     * 任务名称
     */
    @Column(name = "task_name")
    public String name;

    /**
     * 任务Id
     */
    @Column(name = "task_type")
    public String typeId;

    /**
     * 任务类型名称
     */
    @Column(name = "task_type_name")
    public String typeName;

    /**
     * 硬件Id
     */
    @Column(name = "hardware_id")
    public String hardwareId;

    /**
     * 硬件名称
     */
    @Column(name = "hardware_name")
    public String hardwareName;

    /**
     * 照片
     */
    @Column(name = "task_images")
    public String images;

    /**
     * 任务状态
     */
    @Column(name = "task_state")
    public String state;

    /**
     * 下发人员id
     */
    @Column(name = "issuer_id")
    public String issuerId;
    /**
     * 下发人员
     */
    @Column(name = "issuer")
    public String issuer;

    /**
     * 报修人员id
     */
    @Column(name = "repairs_id")
    public String repairsId;

    /**
     * 报修部门id
     */
    @Column(name = "repairs_dep_id")
    public String repairsDepId;
    /**
     * 报修部门
     */
    @Column(name = "repairs_dep")
    public String repairsDep;
    /**
     * 报修人员
     */
    @Column(name = "repairs")
    public String repairs;


    /**
     * 处理人员
     */
    @Column(name = "handler")
    public String handler;

    /**
     * 任务说明
     */
    @Column(name = "task_specification")
    public String specification;


    /**
     * 问题描述及处理情况
     */
    @Column(name = "task_description")
    public String description;

    /**
     * 下发时间
     */
    @Column(name = "issue_date")
    public String issueDate;

    /**
     * 完成时间
     */
    @Column(name = "start_date")
    public String startDate;
    /**
     * 完成时间
     */
    @Column(name = "finish_date")
    public String finishDate;


    /**
     * 是否解决
     */
    @Column(name = "sloved")
    public String sloved;

    //默认的构造方法必须写出，如果没有，这张表是创建不成功的
    public MaintainTaskInfo() {

    }

    public void ParseMaintainTaskInfo(JSONObject jsonObject) throws Exception {

        this.taskId = jsonObject.getString("ROWGUID");
        this.name = jsonObject.getString("TASKNAME");
        switch (jsonObject.getString("TASKSTATUS")) {
            case "0":
                this.state = "1";
                break;

            case "1":
                this.state = "1";

                break;
            case "2":
                this.state = "2";
                break;
        }
        this.typeId = jsonObject.getString("TASKVARIETY");
        switch (jsonObject.getString("TASKVARIETY")) {
            case "1":
                this.typeName = "硬件";
                break;

            case "2":
                this.typeName = "软件";

                break;
            case "3":
                this.typeName = "网络";
                break;
            case "4":
                this.typeName = "光纤";
                break;
            case "5":
                this.typeName = "其他";
                break;
            default:
                this.typeName = "";
                break;
        }
        this.hardwareId = jsonObject.getString("HARDWAREGUID");
        this.hardwareName = jsonObject.getString("ASSETNAME");
        this.issuer = jsonObject.getString("RELEASEMAN");

        this.issueDate = jsonObject.getString("TASKRELEASETIME");
        this.startDate = jsonObject.getString("TASKSTARTTIME");
        this.finishDate = jsonObject.getString("TASKENDTIME");
        this.repairsDep =  jsonObject.getString("REGISTDEPNAME");
        this.repairs = jsonObject.getString("REGISTMANNAME");
        this.specification = jsonObject.getString("CONTENT");
        this.sloved = jsonObject.getString("ISPROCESS");
        this.description = jsonObject.getString("PROCESSCONTENT");


    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
//
//    public String getRowguid() {
//        return rowguid;
//    }
//
//    public void setRowguid(String rowguid) {
//        this.rowguid = rowguid;
//    }
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public String getType() {
//        return type;
//    }
//
//    public void setType(String type) {
//        this.type = type;
//    }
//
//    public String getState() {
//        return state;
//    }
//
//    public void setState(String state) {
//        this.state = state;
//    }
//
//    public String getHardware() {
//        return hardware;
//    }
//
//    public void setHardware(String hardware) {
//        this.hardware = hardware;
//    }
//
//    public String getIssuer() {
//        return issuer;
//    }
//
//    public void setIssuer(String issuer) {
//        this.issuer = issuer;
//    }
//
//    public String getRepairs() {
//        return repairs;
//    }
//
//    public void setRepairs(String repairs) {
//        this.repairs = repairs;
//    }
//
//    public String getHandler() {
//        return handler;
//    }
//
//    public void setHandler(String handler) {
//        this.handler = handler;
//    }
//
//    public String getSpecification() {
//        return specification;
//    }
//
//    public void setSpecification(String specification) {
//        this.specification = specification;
//    }
//
//    public String getResult() {
//        return result;
//    }
//
//    public void setResult(String result) {
//        this.result = result;
//    }
//
//    public String getDescription() {
//        return description;
//    }
//
//    public void setDescription(String description) {
//        this.description = description;
//    }
//
//    public String getIssueDate() {
//        return issueDate;
//    }
//
//    public void setIssueDate(String issueDate) {
//        this.issueDate = issueDate;
//    }
//
//    public String getFinishDate() {
//        return finishDate;
//    }
//
//    public void setFinishDate(String finishDate) {
//        this.finishDate = finishDate;
//    }
//
//    public String getSloved() {
//        return sloved;
//    }
//
//    public void setSloved(String sloved) {
//        this.sloved = sloved;
//    }
}
